<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta content="text/javascript" http-equiv="content-script-type">
<title>tango.text.stream.LineIterator</title>

<link rel="stylesheet" type="text/css" href="css/style.css">
<!--[if lt IE 7]><link rel="stylesheet" type="text/css" href="css/ie56hack.css"><![endif]-->
<script language="JavaScript" src="js/util.js" type="text/javascript"></script>
<script language="JavaScript" src="js/tree.js" type="text/javascript"></script>
<script language="JavaScript" src="js/explorer.js" type="text/javascript"></script>
<script>
function anchorFromTitle(title, path, ext) {
  var url = path + title + "." + ext;
  document.write("<a href='" + url + "'>" + title + "</a>");
  }
</script>
</head><body>
<div id="tabarea"></div><div id="explorerclient"></div>
<div id="content"><script>explorer.initialize("tango.text.stream.LineIterator");</script>
        <table class="content">
                <tr><td id="docbody"><h1><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/text/stream/LineIterator.d?rev=3461">tango.text.stream.LineIterator</a></h1>
                
<b>License:</b><br>
BSD style: see <a href="http://www.dsource.org/projects/tango/wiki/LibraryLicense">license.txt</a><br><br>
<b>Version:</b><br>
Initial release: January 2006<br><br>
<b>author:</b><br>Kris<br><br>
<dl>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>class <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/text/stream/LineIterator.d?rev=3461#L42">LineIterator</a></span>
<script>explorer.outline.addDecl('LineIterator');</script>(T) : StreamIterator!(T);</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Iterate across a set of text patterns.</font><br><br>
<font color="black">Each pattern is exposed to the client as a slice of the original
        content, where the slice is transient. If you need to retain the
        exposed content, then you should .dup it appropriately. <br><br>        These iterators are based upon the IBuffer construct, and can
        thus be used in conjunction with other Iterators and/or Reader
        instances upon a common buffer ~ each will stay in lockstep via
        state maintained within the IBuffer.<br><br>        The content exposed via an iterator is supposed to be entirely
        read-only. All current iterators abide by this rule, but it is
        possible a user could mutate the content through a get&#40;&#41; slice.
        To enforce the desired read-only aspect, the code would have to 
        introduce redundant copying or the compiler would have to support 
        read-only arrays.<br><br>        See LineIterator, SimpleIterator, RegexIterator, QuotedIterator.<br><br>
</font><br><br>
<dl>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li><span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/text/stream/LineIterator.d?rev=3461#L74">this</a></span>
<script>explorer.outline.addDecl('this');</script>(InputStream <span class="funcparam">stream</span> = null);</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Construct an uninitialized iterator. For example:
                <pre class="d_code">

                <span class="k">auto</span> <span class="i">lines</span> = <span class="k">new</span> <span class="i">LineIterator</span>!(<span class="k">char</span>);

                <span class="k">void</span> <span class="i">somefunc</span> (<span class="i">IBuffer</span> <span class="i">buffer</span>)
                {
                        <span class="k">foreach</span> (<span class="i">line</span>; <span class="i">lines</span>.<span class="i">set</span>(<span class="i">buffer</span>))
                                 <span class="i">Cout</span> (<span class="i">line</span>).<span class="i">newline</span>;
                }
                
</pre></font><br><br>
<font color="black">Construct a streaming iterator upon a buffer:
                <pre class="d_code">

                <span class="k">void</span> <span class="i">somefunc</span> (<span class="i">IBuffer</span> <span class="i">buffer</span>)
                {
                        <span class="k">foreach</span> (<span class="i">line</span>; <span class="k">new</span> <span class="i">LineIterator</span>!(<span class="k">char</span>) (<span class="i">buffer</span>))
                                 <span class="i">Cout</span> (<span class="i">line</span>).<span class="i">newline</span>;
                }
                
</pre>
                
                Construct a streaming iterator upon a conduit:
                <pre class="d_code">

                <span class="k">foreach</span> (<span class="i">line</span>; <span class="k">new</span> <span class="i">LineIterator</span>!(<span class="k">char</span>) (<span class="k">new</span> <span class="i">FileConduit</span> (<span class="sl">"myfile"</span>)))
                         <span class="i">Cout</span> (<span class="i">line</span>).<span class="i">newline</span>;
                
</pre><br><br></font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>bool <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/text/stream/LineIterator.d?rev=3461#L86">readln</a></span>
<script>explorer.outline.addDecl('readln');</script>(inout T[] <span class="funcparam">content</span>); [final]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Read a line of text, and return false when there's no
                further content available.</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>uint <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/text/stream/LineIterator.d?rev=3461#L99">scan</a></span>
<script>explorer.outline.addDecl('scan');</script>(void[] <span class="funcparam">data</span>); [protected]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Scanner implementation for this iterator. Find a '\n',
                and eat any immediately preceeding '\r'
                
</font><br><br></dd></dl></dd></dl></td></tr>
                <tr><td id="docfooter">
                        Copyright (c) 2004 Kris Bell. All rights reserved :: page rendered by CandyDoc. Generated by <a href="http://code.google.com/p/dil">dil</a> on Sun Jun  8 17:12:55 2008.
                </td></tr>
        </table>
</div>
<script></script>
</body></html>